import { aesEncode } from '@/utils/handle-crypto';
import request from 'umi-request';

export function login(body: USER.LoginParams) {
  return request<USER.LoginResult>('/api/system-user/v1.0.0/login', {
    method: 'POST',
    data: { data: aesEncode(body) },
  });
}

export function queryCurrentUser() {
  return request<USER.CurrentUser>('/api/system-user/v1.0.0/currentUser');
}

export async function logout() {
  await request('/api/system-user/v1.0.0/logout', {
    method: 'POST',
  });
}
